A bounding box. Often used to encompass object's bounds in the world. More...
Public Member Functions | |
BoundingBox () | |
BoundingBox (const nkMaths::Vector ¢er, float cubeHalfSide) | |
BoundingBox (const nkMaths::Vector ¢er, const nkMaths::Vector &axisAlignedHalfSides) | |
~BoundingBox () | |
const std::array< nkMaths::Vector, 8 > & | getPoints () const |
const std::array< nkMaths::Vector, 8 > & | getTransformedPoints () const |
nkMaths::Vector | getCenter () const |
nkMaths::Vector | getAxisAlignedSides () const |
void | setPoints (const std::array< nkMaths::Vector, 8 > &points) |
void | updateTransformation (Node *node) |
bool | checkAgainst (const Frustum &frustum) const |
A bounding box. Often used to encompass object's bounds in the world.
Can be used to check against a frustum and do culling.
nkGraphics::BoundingBox::BoundingBox | ( | ) |
Default constructor.
nkGraphics::BoundingBox::BoundingBox | ( | const nkMaths::Vector & | center, |
float | cubeHalfSide | ||
) |
Constructor.
center | The center of the box to create. |
cubeHalfSide | The half extent, uniform along the 3 axis (x, y, z), used to form a cube. |
nkGraphics::BoundingBox::BoundingBox | ( | const nkMaths::Vector & | center, |
const nkMaths::Vector & | axisAlignedHalfSides | ||
) |
Constructor.
center | The center of the box to create. |
axisAlignedHalfSides | The half extents, for each axis. |
nkGraphics::BoundingBox::~BoundingBox | ( | ) |
Destructor.
const std::array<nkMaths::Vector, 8>& nkGraphics::BoundingBox::getPoints | ( | ) | const |
const std::array<nkMaths::Vector, 8>& nkGraphics::BoundingBox::getTransformedPoints | ( | ) | const |
nkMaths::Vector nkGraphics::BoundingBox::getCenter | ( | ) | const |
nkMaths::Vector nkGraphics::BoundingBox::getAxisAlignedSides | ( | ) | const |
void nkGraphics::BoundingBox::setPoints | ( | const std::array< nkMaths::Vector, 8 > & | points | ) |
Sets new points to use for the box.
points | The points to use. |
void nkGraphics::BoundingBox::updateTransformation | ( | Node * | node | ) |
Updates the transformed points with a node transformation.
node | The node from which to retrieve the transformation. |
bool nkGraphics::BoundingBox::checkAgainst | ( | const Frustum & | frustum | ) | const |
Checks the box against a frustum to know if it is inside or not.
frustum | The frustum to check against. |